import QtQuick 2.6

import "../Config"
import Cpp.Type 1.0

/*
  usage :

SubjectImage {
    anchors.verticalCenter: parent.verticalCenter
    subject: root.subject
}
  */
Rectangle {
    property int subject

    width: 40 * Size.ratio
    height: width * 0.618
    color: {
        if(subject === Subject.Paint)
            return Color.paint
        if(subject === Subject.Pe)
            return Color.pe
        return Color.music
    }
    Text {
        anchors.centerIn: parent
        color: "white"
        text: {
            if(subject === Subject.Paint)
                return qsTr("美术")
            if(subject === Subject.Pe)
                return qsTr("体育")
            if(subject === Subject.Music)
                return qsTr("音乐")
            return qsTr("未知")
        }
        verticalAlignment: Text.AlignVCenter
        horizontalAlignment: Text.AlignHCenter
        font.pixelSize: Size.smallFont * 0.9
    }
    radius: 7 * Size.ratio
}
